package com.it.controller;


import com.it.pojo.Books;
import com.it.pojo.PageBean;
import com.it.pojo.Result;
import com.it.pojo.User;
import com.it.service.UserService;
import com.it.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/users")
public class UsersController {
    @Autowired
    private UsersService usersService;


    @GetMapping
    public Result<PageBean<User>> list(
            @RequestParam(defaultValue = "1") Integer pageNum,
            @RequestParam(defaultValue = "10") Integer pageSize
    ) {
        PageBean<User> pb = usersService.list(pageNum, pageSize);
        return Result.success(pb);
    }

    @DeleteMapping
    public Result deleteArticle(@RequestParam Integer id){
        usersService.deleteusers(id);
        return  Result.success();
    }
}
